#ifndef __STATE__
#define __STATE__

#include <iostream>

using namespace std;

class State;
class ConcreteState1;
class ConcreteState2;

class Context
{
	public:
		Context(State* pState):a_pState(pState) {};
		virtual ~Context() {};

		void Request();
	
	private:
		friend class ConcreteState1;
		friend class ConcreteState2;
		//具体的状态类调用该接口改变状态
		void ChangeState(State* pState);

		State* a_pState;

};


class State
{
	public:
		virtual ~State() {};
		virtual void Handle(Context* pContext) = 0;
};


class ConcreteState1: public State
{
	public:
		ConcreteState1() {};
		virtual ~ConcreteState1() {};
		virtual void Handle(Context* pContext);
};


class ConcreteState2: public State
{
	public:
		ConcreteState2() {};
		virtual ~ConcreteState2() {};
		virtual void Handle(Context* pContext);
};



#endif
